package results;

import java.io.Serializable;
import utils.*;
import objects.Sink;
import java.util.*;

import kernel.*;
import communication.thirdLayer.*;

public class ProbeDirectedDiffusion extends ProbeSink {

    private static final String PROPERTY_NAME = "ProbeDirectedDiffusion";
    
    /**
     * Get the property Name
     * @return property name
     * @see Results.Probe#getPropertyName()
     */
    public String getPropertyName() {
	return PROPERTY_NAME;
    }
    
    /**
     * Get the descitption of the probe
     * @return probe description
     * @see Results.Probe#getProbeDescription()
     */
    public String getProbeDescription() {
	return "";
    }
    
    public ProbeDirectedDiffusion(Sink s, String p) {
	super(s,p);
    }

    public Object getValue() {
	HashMap<Integer,DirectedResults> hm = ((DirectedDiffusion)((Sink)_linkedStation).getSimulator().getCommunicationManager().
					       getTLManager().getTLProtocol()).getResults();
	Vector<String> result = new Vector<String>();
	Set keys = hm.keySet();
	Iterator i = keys.iterator();
	while(i.hasNext()){
	    Integer index = (Integer)i.next();
	    String res = index +  ": State= "+ hm.get(index).getState() + "\n | PrimaryPath= " + hm.get(index).getPrimaryPath() 
		+ "\n | TimeEllapsed= " + hm.get(index).getTimeEllapsed() + "\n";
	    result.add(res);
	}
	return result;
	
    }

}
